<!--商品管理列表-->
<div ms-controller="goods" class="goods">
    <div class="go-title">
        <div>
            <span style="color: #66a8bc;cursor: pointer">商品管理</span>
            <span ms-if='GoodsId!=-1'>&nbsp;&RightAngleBracket;商品详情</span>&nbsp;&nbsp;
            <a class="btn btn-success btn-xs" ms-click="edit(-1)">
                <i class="icon-plus-sign"></i>
                添加商品
            </a>

            <!--查看当前是启用还是禁用-->
            <div class="btn-toggle pull-right" ms-class="toggle-right:listType==1"
                 ms-class-2="toggle-left:listType==0">
                <span class="btn-t-left">启用的</span>
                <div class="btn-t-out" ms-click='toListType("auto")'>
                    <div class="btn-t-in" ></div>
                </div>
                <span class="btn-t-right">禁用的</span>
            </div>
        </div>
        <br/>
        <!--非编辑状态-->
        <!--<div class="go-card new-goods text-center" ms-if="editing!=-1" ms-click="edit(-1)">
                <span style="color:#c6c6c6">
                    <i class="icon-plus icon-3x"></i><br/>
                添加商品
                </span>

        </div>-->

        <!--编辑状态-->
        <div class="go-card new-goods " ms-if="editing==-1" style="cursor: auto">

            <div class="go-card-head " style="margin-bottom: 10px">
                <input type="text" maxlength="50" onkeyup="cutLength(this)" class=" go-input-title" placeholder="输入商品名称" ms-duplex="New.Name"/>

                <span class="c-type" ms-class="c-type-0:New.Virtual==0" ms-click="editType(0)">实体</span>

                <span class="c-type" ms-class="c-type-1:New.Virtual==1" ms-click="editType(1)">虚拟</span>

                <div class=" pull-right" >
                    <a class="btn btn-xs btn-success " ms-click="add"><i class=" icon-ok"></i>保存</a>
                    <a class="btn btn-xs btn-default" ms-click="addOver"><i class=" icon-remove"></i>取消</a>
                </div>
            </div>
            <div class="go-card-body box-row hor-ends warp go-add-box" style="line-height: 26px;">
                <div>
                    型号：
                    <input type="text" maxlength="50" onkeyup="cutLength(this)" class="go-input-body" style="width: 90px" ms-duplex="New.Model"/>

                </div>
                <div>
                    规格：
                    <input type="text" maxlength="50" onkeyup="cutLength(this)" class="go-input-body" style="width: 90px" ms-duplex="New.Standard"/>
                </div>
                <div>
                    单位：
                    <input type="text" maxlength="50" onkeyup="cutLength(this)" class="go-input-body" style="width: 90px" ms-duplex="New.Unit"/>
                </div>
                <div>
                    商品号：
                    <input type="text" maxlength="50" onkeyup="cutLength(this)" class="go-input-body" style="width: 90px" ms-duplex="New.Number"/>
                </div>
                <div>
                    条形码：
                    <input type="text" maxlength="50" onkeyup="cutLength(this)" class="go-input-body" style="width: 90px" ms-duplex="New.BarCode"/>
                </div>
                <div>
                    商品备注：
                    <input type="text" maxlength="50" onkeyup="cutLength(this)" class="go-input-body" style="width: 290px" ms-duplex="New.Memo"/>

                </div>


            </div>
            <div class="go-card-body box-row  warp">
                <div>
                    初始成本价：
                    <input type="number"  class="go-input-body" style="width: 90px" ms-duplex="New.Price0"/>
                </div>
                &nbsp;&nbsp;&nbsp;
                <div>
                    标价：
                    <input type="number"  class="go-input-body" style="width: 90px" ms-duplex="New.Price1"/>
                </div>
                &nbsp;&nbsp;&nbsp;
                <div>
                    初始库存：
                    <input type="number" maxlength="50" onkeyup="cutLength(this)" class="go-input-body" style="width: 90px" ms-duplex="New.Amount"/>
                </div>
                &nbsp;&nbsp;&nbsp;
                <div>
                    库存最大值：
                    <input type="number" maxlength="50" onkeyup="cutLength(this)" class="go-input-body" style="width: 90px" ms-duplex="New.Max"/>
                </div>
                &nbsp;&nbsp;&nbsp;
                <div>
                    库存最小值：
                    <input type="number" maxlength="50" onkeyup="cutLength(this)" class="go-input-body" style="width: 90px" ms-duplex="New.Min"/>
                </div>


            </div>
        </div>

        <!--<div class="box-row flexBox hor-ends">-->
            <!-- 分类相关 todo 暂时关闭-->
            <!--<div>-->
                <!--按类别筛选：-->
                <!--<button class="btn btn-default"  ms-click="letShowClass">&lt;!&ndash;ms-class="showIng:showClass"&ndash;&gt;-->
                    <!--{{className}}-->
                    <!--&lt;!&ndash;&nbsp;&ndash;&gt;-->

                    <!--<b class=" icon-chevron-down " ms-if="!showClass"></b>-->
                    <!--<b class=" icon-chevron-up " ms-if="showClass"></b>-->
                <!--</button>-->
                <!--&nbsp;&nbsp;-->
                <!--<a style="color: #65A1B9;font-size:12px;" ms-click="resetClass">重置</a>-->
                <!--&nbsp;&nbsp;&nbsp;-->

            <!--</div>-->
            <!--<div>-->
                <!--<input type="text" maxlength="50" onkeyup="cutLength(this)" class="go-input-title" ms-duplex="newClassName" placeholder="新分类名称"/>-->
                <!--&nbsp;-->
                <!--<a class="btn btn-success btn-xs" ms-click="addClass">创建分类</a>-->
            <!--</div>-->


        <!--</div>-->
        <!--<div class="panel" style="margin-top: 10px;" ms-visible="showClass">-->
            <!--<div class="flexBox hor-ends">-->
                <!--<div>-->
                    <!--分类列表：-->
                    <!--<small ms-visible="!classEditing" style="font-weight: normal;">（点击分类，查看该分类下的商品）</small>-->
                <!--</div>-->

                <!--<div>-->
                    <!--<button class="btn btn-sm btn-default pull-right" style="height:30px;" ms-class="btn-primary:classEditing"-->
                            <!--ms-click="toggleEdit">-->
                        <!--<i class="icon-cog"></i>-->
                        <!--&nbsp;-->
                        <!--<span ms-if="!classEditing">开启</span>-->
                        <!--<span ms-if="classEditing">关闭</span>-->
                        <!--类别管理-->
                    <!--</button>-->
                <!--</div>-->
            <!--</div>-->
            <!--<br/>-->
            <!--<div ms-visible="!classEditing">-->
                <!--&lt;!&ndash;repeat&ndash;&gt;-->
                <!--<a class="btn btn-sm btn-default" style="margin-right: 10px;margin-bottom: 7px"-->
                   <!--ms-repeat="classList" ms-click="byClass(el.ClassID,$index)">-->
                    <!--{{el.ClassName}}-->
                <!--</a>-->
            <!--</div>-->
            <!--<div ms-visible="classEditing" class="box-row warp" style="margin-bottom: 10px">-->
                <!--&lt;!&ndash;repeat&ndash;&gt;-->
                <!--<div class="panel" style="margin-right: 10px"-->
                     <!--ms-repeat="classList" >-->
                <!--<span  ms-visible="CEindex!=$index">-->
                    <!--{{el.ClassName}}-->
                <!--</span>-->
                    <!--<input type="text" maxlength="50" onkeyup="cutLength(this)" class="go-input-title" ms-duplex="editingName"  ms-visible="CEindex==$index"/>-->
                <!--<span ms-visible="CEindex!=$index">-->
                    <!--<button class="btn btn-xs  btn-success" ms-click="toEdit($index)">修改</button>-->
                    <!--<button class="btn btn-xs " ms-click="delClass($index)">删除</button>-->
                <!--</span>-->
                <!--<span  ms-visible="CEindex==$index">-->
                     <!--<button class="btn btn-xs btn-success btn-default" ms-click="saveClass($index)">保存</button>-->
                    <!--<button class="btn btn-xs " ms-click="closeCE">取消</button>-->
                <!--</span>-->
                <!--</div>-->
            <!--</div>-->

        <!--</div>-->


    </div>

    <!--商品管理列表-->
    <table  class="table table-bordered all-table">
        <thead>
        <tr>
            <td style="min-width: 121px;">
                操作
            </td>
            <td>
                名称
            </td>
            <td>
                条码
            </td>
            <td>
                型号
            </td>
            <td>
                规格
            </td>
            <td>
                总库存
            </td>
            <!--<td>
                单位
            </td>-->
            <td>
                类型
            </td>
            <td>
                加权成本
            </td>
            <td>
                标准售价
            </td>
            <!--<td>
                上限
            </td>
            <td>
                下限
            </td>
            <td>
                属性
            </td>-->
            <td>
                状态操作
            </td>
        </tr>
        </thead>
        <tbody>
        <!-- 商品列表循环-->
        <tr ms-repeat="list" ms-visible="listType==el.Disable">
            <td>
                <a class="btn btn-success btn-xs" ms-click="toInfo(el.GoodsID)" >详情</a>
                <a class="btn btn-primary btn-xs" ms-click="addToCar($index)" >备选</a>
            </td>
            <!--<a class=" btn btn-xs btn-default" style="" ms-click="toInfo(el.GoodsID,1)">
                    <i class="icon-pencil"></i>&nbsp;编辑
                </a>
                <a class="btn btn-xs btn-success" ms-click="toBillPur(el)">
                    <i class="icon-inbox"></i>&nbsp;入库
                </a>-->
            <td>
                <a ms-click="toInfo(el.GoodsID)" style="cursor: pointer">
                    {{el.Name}}
                </a>

            </td>
            <td>
                {{el.BarCode}}
            </td>
            <td>
                {{el.Model}}
            </td>
            <td>
                {{el.Standard}}
            </td>
            <td>
                ×{{el.StoreTotal}}
            </td>
           <!-- <td>
                {{el.Unit}}
            </td>-->
            <td>
                <span ms-if='el.ClassName=="NotClassed"'>
                    未分类
                </span>
                <span ms-if='el.ClassName!="NotClassed"'>
                    {{el.ClassName}}
                </span>
            </td>
            <td>
                {{el.Price0}}
            </td>
            <td>
                {{el.Price1}}
            </td>
            <!--<td>
                {{el.Max}}
            </td>
            <td>
                {{el.Min}}
            </td>
            <td>
                <span class="c-type c-type-0" ms-if="el.Virtual==0">实体</span>

                <span class="c-type c-type-1" ms-if="el.Virtual==1">虚拟</span>
            </td>-->
            <td>
                <span class="btn btn-default btn-xs " ms-if="el.Disable==1" ms-click="changeState(0,el.GoodsID,$index)">启用</span>

                <span class="btn btn-default btn-xs " ms-if="el.Disable==0" ms-click="changeState(1,el.GoodsID,$index)">禁用</span>
            </td>
        </tr>
        </tbody>

    </table>


    <a class="btn btn-block btn-default" ms-click="getGoods"
       ms-if='className=="选择类型"&&(T-P*48>0)'>
        加载更多商品 <small>(还有 {{T - P*48}} 条数据)</small>
    </a>
    <a class="btn btn-block btn-default" ms-click="byClass"
       ms-if='className!="选择类型"&&(CT-CP*48>0)'>
        加载 {{className}} 下的更多商品 <small>(还有 {{CT - CP*48}} 条数据)</small>
    </a>
</div>
